import Vue from "vue";
import VueRouter from "vue-router";
// import Header from "@/components/headerView.view"
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/home", // 路由的重定向
  },
  {
    path: "/home", //首页
    name: "home",
    component: () => import("@/views/HomeView/HomeView.vue"),
  },
  {
    path: "/swiperdetails", //蓝湖轮播图1
    name: "swiperdetails",
    component: () => import("@/views/HomeView/swiperdetails.vue"),
  },
  {
    path: "/choiceness", //精选人气印花
    name: "choiceness",
    component: () => import("@/views/HomeView/choiceness.vue"),
  },
  {
    path: "/electronics", //电子产品-分类页
    name: "electronics",
    component: () => import("@/views/HomeView/electronics.vue"),
  },
  {
    path: "/classify", //分类
    name: "classify",
    component: () => import("@/views/HomeView/classify.vue"),
  },
  {
    path: "/joint", //联名（蓝湖轮播图2）
    name: "joint",
    component: () => import("@/views/HomeView/joint.vue"),
  },
  {
    path: "/goodsdetails", //商品详情页
    name: "goodsdetails",
    component: () => import("@/views/HomeView/goodsdetails.vue"),
  },
  {
    path: "/pejiandetail", //配件详情页
    name: "pejiandetail",
    component: () => import("@/views/HomeView/peijiandetail.vue"),
  },
  {
    path: "/artdetail", //艺术系列详情页
    name: "artdetail",
    component: () => import("@/views/HomeView/artdetail.vue"),
  },
  {
    path: "/artlist", //艺术列表
    name: "artlist",
    component: () => import("@/views/HomeView/artlist.vue"),
  },
  {
    path: "/customization", //个性化定制
    name: "customization",
    component: () => import("@/views/HomeView/customization.vue"),
  },
  {
    path: "/mountings", //周边配置
    name: "mountings",
    component: () => import("@/views/HomeView/mountings.vue"),
  },
  {
    path: "/login", //登录
    name: "login",
    component: () => import("@/views/user/Login.vue"),
  },
  {
    path: "/register", //注册
    name: "register",
    component: () => import("@/views/user/register.vue"),
  },
  {
    path: "/forget", //忘记密码
    name: "forget",
    component: () => import("@/views/user/forget.vue"),
  },
  {
    path: "/shoppingCart", //购物车主页
    name: "shoppingCart",
    component: () => import("@/views/shoppingCart/index.vue"),
  },
  {
    path: "/buymore", //加购成功
    name: "buymore",
    component: () => import("@/views/shoppingCart/buymore.vue"),
  },
  {
    path: "/closing", //结算成功
    name: "closing",
    component: () => import("@/views/shoppingCart/closing.vue"),
  },
  {
    path: "/mine",
    path: "/mine", //主页
    name: "mine",
    component: () => import("@/views/mine/mine.vue"),
  },
  {
    path: "/bankCard", //银行卡
    name: "bankCard",
    component: () => import("@/views/mine/bankCard.vue"),
  },
  {
    path: "/svip", //银卡会员
    name: "svip",
    component: () => import("@/views/mine/svip.vue"),
  },
  {
    path: "/ssvip", //金卡会员
    name: "ssvip",
    component: () => import("@/views/mine/ssvip.vue"),
  },
  {
    path: "/accountInfo",
    name: "accountInfo",
    component: () => import("@/views/mine/accountInfo.vue"),
    children: [
      {
        path: "/accountInfo/accountPerson", //账户资料
        name: "accountPerson",
        component: () => import("@/views/mine/account/accountPerson.vue"),
      },
      {
        path: "/accountInfo/address", // 收货地址
        name: "address",
        component: () => import("@/views/mine/account/addres.vue"),
      },
      {
        path: "/accountInfo/questionList", //相关问题
        name: "questionList",
        component: () => import("@/views/mine/account/questionList.vue"),
      },
    ],
  },
  {
    path: "/myWallet",
    name: "myWallet",
    component: () => import("@/views/mine/myWallet.vue"),
  },
  {
    path: "/coupon",
    name: "coupon",
    component: () => import("@/views/mine/coupon.vue"),
  },
  {
    path: "/worksLibrary",
    name: "worksLibrary",
    component: () => import("@/views/mine/worksLibrary.vue"),
  },
  {
    path: "/worksMake",
    name: "worksMake", //作品库制作选择机种
    component: () => import("@/views/mine/worksMake.vue"),
  },
  {
    path: "/worksMaketwo",
    name: "worksMaketwo", //作品库制作选择机型
    component: () => import("@/views/mine/worksMaketwo.vue"),
  },
  {
    path: "/member",
    name: "mamber",
    component: () => import("@/views/mine/member.vue"),
  },
  {
    path: "/order",
    name: "order",
    component: () => import("@/views/mine/order.vue"),
  },
  {
    path: "/orderDetail",
    name: "orderDetail",
    component: () => import("@/views/mine/orderDetail.vue"),
  },
];

const originPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originPush.call(this, location).catch(() => {});
};
const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes,
});

export default router;
